import Kits from "../kit/Kits";
import OperateData from "./OperateData";
import UserData from "./UserData";


const { ccclass, property } = cc._decorator;

@ccclass
export default class EventItem extends cc.Component {

    @property(cc.Label)
    lbAge: cc.Label = null;

    @property(cc.Label)
    lbDes: cc.Label = null;

    private eventIndex = 0;
    start() {

    }

    init(index) {
        this.eventIndex = index;
        this.updateUI();
    }

    private updateUI() {
        this.lbAge.string = Kits.formatAge(this.age);
        this.lbDes.string = this.eventDes;
    }

    get age() {
        let age = this.eventIndex * 3;
        return age;
    }

    get eventDes() {

        let des = "";
        if (this.age == 0) {
            des = `你出生了`;
        } else {
            des = OperateData.getDesByAge(this.age);
        }
        return des;
    }


}
